package leetcode_1801_1900;

import java.util.Arrays;

public class LeeCode_1877 {
    public static void main(String[] args) {
        System.out.println(minPairSum(new int[]{2, 3, 4, 4, 5, 6}));
    }
    private static int minPairSum(int[] nums) {
        Arrays.sort(nums);
        int n = nums.length, ans = 0, l = 0, r = n - 1;
        while (l < r){
            ans = Math.max(ans, nums[l++] + nums[r--]);
        }
        return ans;
    }
}
